<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>文件上传基本功能</title>
		<script>
			function fgetfilename(){
				debugger
				var upload_form1 = document.getElementById("upload_form1");
			    var file_inp1 = document.getElementById("file_inp1");
				if (upload_form1){
					let origin_name=file_inp1.files[0].name;
					console.log(origin_name);
					//upload_form1.append("origin_name",origin_name);
					var ext2= document.getElementById("ext2");
					var shtm = "动态附加域(原文件名)<input type=\'text\' name=\'xtxt2\' value=\'"+origin_name+"\'/>";
					ext2.innerHTML = shtm;
				}
			}
			
		</script>
	</head>
	<body>
		文件上传基本功能<br>
    <form id="upload_form1" action="http://localhost:8084/myminio/fileupload1" method="post" enctype="multipart/form-data">
        <!--method必须为post enctype必须设置为multipart/form-data否则后台的HttpFileCollection的Count属性为0-->
        <input id="file_inp1" type="file" name="xfile" onchange="fgetfilename()" /><br>
		按xfile作为name<br>
        附加域1:<input id="ext_inp1" type="text" name="xtxt1" value="附加域1值"/>
		<br><div id="ext2"></div>
        <br><input id="file_submit1" type="submit"  value="上传文件" />
    </form> <br>
	------------------------------<br>
		图片上传功能(*.jpg,*.png)<br>
    <form id="upload_form2" action="http://localhost:8084/myminio/fileupload2" method="post" enctype="multipart/form-data">
        <!--method必须为post enctype必须设置为multipart/form-data否则后台的HttpFileCollection的Count属性为0-->
        <input id="file_inp2" type="file" name="pfile" accept=".jpg,.png" /><br>
		accept写法: .jpg,.png,image/*,image/png, image/jpeg, image/gif, image/jpg<br>
		按pfile作为name<br>
        <br><input id="file_submit2" type="submit"  value="上传图片" />
    </form> <br>
	
	</body>
</html>
